#include <stdio.h>
#include <math.h>

int main(void)
{
	int m, n, i;

	printf("Input some integers greater than 1 and ending with -1: ");
	scanf("%d", &n);
	while (n != -1)
	{
		m = (int)(sqrt(n) + 1);
		for (i = 2; i < m; i++)
			if (n % i == 0)
				break;
		if (i == m)
			printf("%d is a prime number.\n", n);
		else
			printf("%d is not a prime number.\n", n);
		scanf("%d", &n);
	}

	return 0;
}